import React, { useState } from 'react'
import { Switch } from "antd"

type typeProps = {
    statu:any,
    ischeck:Function
}
const statu:React.FC<typeProps> = ({statu,ischeck}) => {
    const onChange = (checked: boolean) => {
        ischeck(+checked,statu.id)
        setcheck(checked)
      };
      let [check,setcheck] = useState(false as any)
      React.useEffect(()=>{
        setcheck(statu.statu*1)
      },[])
  return (
    <Switch checked={check} onChange={onChange} />
  )
}

export default statu